<extend name='layout:index'/>
<block name='content'>


<div class="panel panel-default" style="background-color:#333333;color:#FFFFFF;
height:50px;margin:20px 30px;width:95%;text-height:50px">
   <span style="font-size:23px; line-height:50px;margin:10px;">输入查看密码</span>
</div>
<div style="margin:20px 30px;">
<form role="form" action="__MODULE__/person/detail" method="post" onSubmit="return checkSubmit(this)">
  <div class="form-group">
 	<div class="form-inline">
    <label for="name">输入查看密码:</label>
    <input name="password" class="form-control" placeholder="输入查看密码" type="password" id='password'>
    &nbsp;&nbsp;
    <span id='empty_password' style='color:red'></span>
  </div>
  </div>
  <div class="form-group">
 	<div class="form-inline">
    <label for="name">图片验证码&nbsp;&nbsp;&nbsp;:</label>
    <input name="code" class="form-control" placeholder="输入验证密码" id='code' type="text">
  <span>
  		<img style='width:120px;height:34px;margin-left:20px' onclick='this.src=this.src+"?id="+Math.random();' src="__URL__/code"  alt="点击刷新">
  </span>
  <span id='empty_code' style='color:red'></span>
  </div>
  </div>
  <div style="margin:10px 110px;">
  
   <button type="submit" class="btn btn-primary block  m-b" style='width:100px'>确定</button>
 </div>
 </form>
</div>


<script type="text/javascript">
      var k = false;
    function checkSubmit()
    {

       
        if($('#password').val() == ''){
           $('#empty_password').html('请输入密码');
            return false;
        }
        if($('#code').val() == ''){
            $('#empty_code').html('请输入验证码');
            return false;
        }

                
         $.ajaxSetup({
             headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
             }
        });
                
        $.ajax({  
            type : 'POST',
            url : '/home/person/dologin',
            data : {password:$('#password').val(),code:$('#code').val()},
            dataType : 'html',
            async : false,
            success : function(str){
                if(str==2){
                     var txt=  "验 证 码 错 误";
                        window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
                    return false;
                }
          
                if(str==22){
                    var txt=  "密 码 错 误";
                        window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
                    return false;
                }
               
                if(str==1){
                    k = true;
                }

        }
        
    });

        return k;
    }
</script>
</block>